@model IEnumerable @{ ViewData["Title"] = "ASP .NET MVC PivotGrid Example"; DataAdapter adapter = new DataAdapter(); adapter.LocalData = Model; adapter.DataFields = new List() { new DataField() {Name = "Country", Type = "string" }, new DataField() {Name = "Value", Type = "number" } }; adapter.DataType = "array"; PivotDataSource dataSource = new PivotDataSource() { DataAdapter = adapter, PivotValuesOnRows = false, Rows = new List() { new PivotRow() {DataField = "Country", Width=190} }, Values = new List() { new PivotValue() {DataField = "Value", Width = 200, Function = "min", Text = "cells left alignment", FormatSettings = new PivotFormatSettings() {Align = "left", Prefix = "", DecimalPlaces=2}}, new PivotValue() {DataField = "Value", Width = 200, Function = "max", Text = "cells center alignment", FormatSettings = new PivotFormatSettings() {Align = "center", Prefix = "", DecimalPlaces=2}}, new PivotValue() {DataField = "Value", Width = 200, Function = "average", Text = "cells right alignment", FormatSettings = new PivotFormatSettings() {Align = "right", Prefix = "", DecimalPlaces=2}} } }; } @section scripts { }
Pivot Grid